#pragma once
#include "xkImgBit.h"
#include "xkImgCheck.h"


class xhHubAnaly
{
public:
	xhHubAnaly(void);
	~xhHubAnaly(void);

public:
	int Initialize();
	int SetHwnd(HWND hWnd = NULL);
	int LoadFile(char *pFileName);
	int SetImgBuffer(zkImgBitInfo *pImgInfo,BOOL bView = TRUE);
	int Operate(DWORD dwProMode,void *pVoid = NULL);
	int GetImgBuffer(zkImgBitInfo **ppImgInfo);
	int GetImageSize(int &nWidth,int &nHeight);
	int Undo(int nStep);
	int Redo();

public:
	int	Draw(void *pVoid = NULL);
	int ImageCtrl(DWORD dwType,void *pVoid = NULL);
	int SaveDispToFile(char *pFileName,void *pVoid = NULL);

public:
	int GetGrayValue(int x,int y,DWORD &dwGray);
	int GetLineGray(POINT tStart,POINT tEnd,zkImgLineGray **ppLineGray);
	int GetHistogramInfo(zkImgHistogram **ppHistogram);
	int SaveFile(char *pFileName,void *pVoid);

public:
	int RegOnDrawCallBack(OnDrawCallBackFun funCallBack,void *pContext);
	int DrawMark(void *pVoid = NULL);

public:
	int GetImageAreaPoint(RECT *pAreaRect,zkImgAreaPoint *pImgArea);
	int SetAreaPoint(void *pVoid);
	int GetRetInfo(void **ppVoid);
	int ConpositeImageTo(void *pImage,RECT *pRect);

private:
	void DefaultDisplayPalette(zkImgBitInfo *pImgInfo);
	int  LoadDataToDisp();
	int  GetExDataFromFile(char *pFileName);
	int  SaveExDataFromFile(char *pFileName);

private:
	xkImgBit *m_pImgBit;
	HWND      m_hWnd;
	DDCriticalSection m_Lock;

private:
	zkImgBitInfo   m_ImgBitInfo;
	zkImgCapParam  m_xImgCapParam;
	BYTE           m_cImgAssBuf[DEFINE_ASS_PARAM_SIZE];
	zkImgAssParam *m_pImgAssParam;
	BYTE          *m_pImgAssData;

	DDReadWriteFile m_xFile;

private:
	DDirectDisplay m_xDisp;

private:
	int   m_nPicSize;
	BYTE *m_pPicBuffer;


};
